package com.iqik.change.controller;

import com.iqik.change.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserCtrl {

    private UserService service;

    @Autowired
    public UserCtrl(UserService service) {
        this.service = service;
    }

    @RequestMapping("/get")
    public String getUser(@RequestParam(value = "id") int id) {
        return service.getUserById(id);
    }

    @RequestMapping("/get/all")
    public List<String> getUsers() {
        return service.getUsers();
    }
}
